package com.example.clxy.util;

import com.example.clxy.result.StandardResult;
import com.example.clxy.result.WebRestResult;

import java.util.List;

/**
 * @author weichong
 * date 2020-08-04
 * @Description:
 */
public class RespUtil {


    public static WebRestResult successResp(String successInfo){
        WebRestResult res = new WebRestResult();
        res.setResult(WebRestResult.SUCCESS);
        res.setMessage(successInfo);
        return res;
    }

    public static WebRestResult failResp(String failInfo){
        WebRestResult res = new WebRestResult();
        res.setResult(WebRestResult.FAILURE);
        res.setMessage(failInfo);
        return res;
    }

    public static StandardResult failStandardResult(String failInfo, List rows){
        StandardResult res = new StandardResult();
        res.setResult(WebRestResult.FAILURE);
        res.setMessage(failInfo);
        res.setRows(rows);
        return res;
    }

    public static StandardResult successStandardResult(String successInfo, List rows){
        StandardResult res = new StandardResult();
        res.setResult(WebRestResult.SUCCESS);
        res.setMessage(successInfo);
        res.setRows(rows);
        return res;
    }

}
